package com.tongji.diy.model.furniturePlacementOptimization.assembleComplement
{
	public class BeddingNearby extends NearBase
	{
		private var _angnistWall:Boolean = false;
		private var _accessDistanceList:Vector.<Number>;
		public function BeddingNearby(furnitureIndex:int,furnitureClass:int, accessDistanceList:Vector.<Number>, angnistWall:Boolean = false ,length:Number=0, width:Number=0, height:Number=0)
		{
			super(furnitureIndex,furnitureClass, angnistWall,length, width, height);
			this._angnistWall = angnistWall;
			_accessDistanceList = accessDistanceList;
			_accessibleBox = buildAccessOBB(x + (_accessDistanceList[3] - _accessDistanceList[2])/ 2,
				y + (-_accessDistanceList[0] +_accessDistanceList[1])/2,
				width + _accessDistanceList[3] + _accessDistanceList[2],
				length + _accessDistanceList[0] + _accessDistanceList[1]);
		}
		
		public function get angnistWall():Boolean
		{
			return _angnistWall;
		}
		
		public override function set x(NewX:Number):void
		{
			super.x = NewX;

			_accessibleBox = buildAccessOBB(NewX + (_accessDistanceList[3] - _accessDistanceList[2])/ 2,
				y + (-_accessDistanceList[0] +_accessDistanceList[1])/2,
				width + _accessDistanceList[3] + _accessDistanceList[2],
				length + _accessDistanceList[0] + _accessDistanceList[1])
			
		}
		
		public override function set y(NewY:Number):void
		{
			super.y = NewY;

			_accessibleBox = buildAccessOBB(x + (_accessDistanceList[3] - _accessDistanceList[2])/ 2,
				NewY + (-_accessDistanceList[0] + _accessDistanceList[1])/2,
				width + _accessDistanceList[3] + _accessDistanceList[2],
				length + _accessDistanceList[0] + _accessDistanceList[1])
			
		}
		
		public override function set angle(NewAngle:Number):void
		{
			super.angle = NewAngle;
			_accessibleBox = buildAccessOBB(x + (_accessDistanceList[3] - _accessDistanceList[2])/ 2,
				y + (-_accessDistanceList[0] + _accessDistanceList[1])/2,
				width + _accessDistanceList[3] + _accessDistanceList[2],
				length + _accessDistanceList[0] + _accessDistanceList[1]);
		}
		
		public function get accessDistance():Vector.<Number>
		{
			return _accessDistanceList;
		}
	}
}